/* 

Replication files for:
"Evaluating the Effect of Descriptive Norms on Political Tolerance"
By Fabian G. Neuner and Mark D. Ramirez
Published in American Politics Research

*/

*******************************************************************************
*****************************    Study 1   ************************************
*******************************************************************************

* Set scheme for figures

set scheme plotplain

* Load data
* Note: ASU 2018 CCES data can also be found here: https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/YALLZ3


use "Study1_data.dta"
	des, short
	
* Setting Weights
svyset _n [pweight=teamweight], vce(linearized) singleunit(missing)	
	
********************** Study 1 Variables & Recodes ***********************


/* Measures of tolerance*/
 
** Recode 5=tolerant 1=intolerant

recode ASU401a 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU401b 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU401c 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU402a 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU402b 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU402c 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU403a 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU403b 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU403c 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU404a 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU404b 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU404c 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU405a 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU405b 8=. 9=. 1=5 2=4 4=2 5=1
recode ASU405c 8=. 9=. 1=5 2=4 4=2 5=1

** Create outcome variables
 
alpha ASU401a ASU401b ASU401c, gen(control) detail
sum control

alpha ASU402a ASU402b ASU402c, gen(tolerant_specific) detail
sum tolerant_specific

alpha ASU403a ASU403b ASU403c, gen(tolerant_universal) detail
sum tolerant_universal

alpha ASU404a ASU404b ASU404c, gen(intolerant_universal) detail
sum intolerant_universal

alpha ASU405a ASU405b ASU405c, gen(intolerant_specific) detail
sum intolerant_specific 

egen outcome= rowtotal(control tolerant_specific tolerant_universal intolerant_universal intolerant_specific)
recode outcome 0=.

* Create variable for the intolerant treatments

gen intolerant_treatment = asu400rand
recode intolerant_treatment 1=0 2=. 3=. 4=1 5=2

* Individual tolerance items 

egen teach = rowtotal(ASU401a ASU402a ASU403a ASU404a ASU405a)
recode teach 0=.

egen rallies = rowtotal(ASU401b ASU402b ASU403b ASU404b ASU405b)
recode rallies 0=. 

egen office = rowtotal(ASU401c ASU402c ASU403c ASU404c ASU405c)
recode office 0=.

** 7-point partisanship and Republican Indicator

recode pid7 8 = . 99 = . 
recode pid7 (4=.) (1/3=0) (5/7=1), gen(Republican)

** Ideology 

recode ideo 6 = . 8 = . 

** White 

gen White = . 
recode White . = 1 if race==1
recode White . = 0 

** African-American racial resentment

recode CC18_422e 8=. 1=5 2=4 4=2 5=1  
recode CC18_422f 8=.
recode CC18_422g 8=.
recode CC18_422h 8=. 1=5 2=4 4=2 5=1

alpha CC18_422e CC18_422f CC18_422g CC18_422h, gen(resentment) detail

** Norm belief

recode ASU408 998=.
rename ASU408 norm_belief

* Rescale 0-1

foreach x in outcome teach rallies office pid7 norm_belief ideo {
sum `x'
gen `x'01 = (`x'-r(min))/(r(max)-r(min))
}


********************** Study 1 Analysis ***********************


** Model 1
svy: reg outcome01 i.asu400rand 
est sto m0

test 4.asu400rand = 5.asu400rand

** Model 2
svy: reg outcome01 i.asu400rand norm_belief01
est sto m1

** Model 3
svy: reg outcome01 norm_belief01 if asu400rand==1
est sto m2

** Model 4 - Partisan Interaction
svy: reg outcome01 i.intolerant_treatment##c.pid701
est sto m4


* Individual items

* Teach
svy: reg teach01 i.asu400rand
est sto m5

* Rally
svy: reg rallies01 i.asu400rand
est sto m6

* Run for office
svy: reg office01 i.asu400rand
est sto m7


* Model 8 - Ideology Interaction
svy: reg outcome01 i.intolerant_treatment##c.ideo01
est sto m8


* Ditribution of least-liked group (Figure 1)
tab ASU301

* Figure 2

svy: reg outcome01 i.asu400rand 

coefplot, drop(_cons) xline(0) msymbol(O) levels(95 90) ///
 plotregion(fcolor(white) lcolor(gs10) lwidth(med)) ///
 ylabel(, /// y-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
xlabel( -.05 0 0.05 .1 .15 .2 .25, /// x-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
 xtitle("ATE of each Treatment vs. Control", color(black)) ///
 mcolor(black) mlcolor(black)  /// point estimate color options
ciopts(lwidth(*0.75 *1.5) lcolor(black black)) ///
coeflabels(2.asu400rand = `""Particularistic" "Tolerant""' 3.asu400rand = `"" Universalistic" "Tolerant""' 4.asu400rand = `""Universalistic" "Intolerant""' 5.asu400rand = `""Particularistic" "Intolerant""') ///
grid(none) //
graph export Figure2.pdf


* Figure 5 

svy: reg outcome01 i.intolerant_treatment if Republican==1 // among Republicans
estimates store s1_Republican

svy: reg outcome01 i.intolerant_treatment if Republican==0 // among Democrats
estimates store s1_Democrat

coefplot (s1_Democrat), bylabel(Among Democrats) ///
 plotregion(fcolor(white) lcolor(gs10) lwidth(med)) ///
  ylabel(, /// y-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
xlabel( -.1 0 .1 .2 .2 .3, /// x-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
 xtitle("ATE of each Treatment vs. Control", color(black)) ///
 mcolor(black) mlcolor(black) msymbol(O)  /// point estimate color options
ciopts(lwidth(*0.75 *1.5) lcolor(black black)) ///
|| (s1_Republican), bylabel(Among Republicans) ///
|| , drop(_cons) yline(0) levels(95 90) coeflabels(1.intolerant_treatment = `"Universalistic Intolerant"' 2.intolerant_treatment = `"Particularistic Intolerant"') ///
xtitle("ATE of each Treatment vs. Control", color(black)) ///
grid(none) ///
xline(0, lp(dash) lcolor(grey)) //
graph export Figure5.pdf


* Note: Table 1 is overview of Studies; no code

* Table 2
esttab m4 using Table2.rtf, replace se label nonumber title("Examining the Effect of Norms of Intolerance, Moderated by Partisanship (Study 1)") mtitle("Model 1")  b(%9.2f) star(* 0.10 ** 0.05) r2 wide


* Table A.1
esttab m0 m1 m2 using TableA1.rtf, replace se label nonumber title("Estimation of Political Tolerance across Treatment Conditions and Perceived Norms (Study 1)") mtitle("Model 1" "Model 2" "Model 3")  b(%9.2f) star(* 0.10 ** 0.05 ) r2 long

* Table A.2
esttab m5 using TableA2.rtf, replace se label nonumber title("Effect of Norms on Rights to Teach (Study 1)") mtitle("Model 1")  b(%9.2f) star(* 0.10 ** 0.05) r2 wide


* Table A.3
esttab m6 using TableA3.rtf, replace se label nonumber title("Effect of Norms on Rights to Hold Rallies (Study 1)") mtitle("Model 1")  b(%9.2f) star(* 0.10 ** 0.05) r2 wide


* Table A.4
esttab m7 using TableA4.rtf, replace se label nonumber title("Effect of Norms on Right to Hold Public Office (Study 1)") mtitle("Model 1")  b(%9.2f) star(* 0.10 ** 0.05) r2 wide

* Table A.8 
esttab m8 using TableA8.rtf, replace se label nonumber title("Examining the Effect of Norms of Intolerance, Moderated by Ideology (Study 1)") mtitle("Model 1")  b(%9.2f) star(* 0.10 ** 0.05) r2 wide


	
